package ru.study.thinkin.chapter12;


class BaseBallException extends Exception{}
class Foul extends BaseBallException {}
class PopFoul extends Foul{}

abstract class Inning {
	public Inning() throws BaseBallException {}
	public void event() throws BaseBallException {
		//не создаем эксепшн
	}
	public abstract void atBat() throws Foul;
	public void walk() {} //Не вызываем исключений
}

class StormException extends Exception{}
class RainedOut extends StormException{}



interface Storm {
	public void event() throws RainedOut;
	public void rainedHard() throws RainedOut;
}


public class StormyInning extends Inning implements Storm{
	public StormyInning() throws RainedOut,BaseBallException {
		throw new RainedOut();
	}
	
	/*@Override
	public void walk() throws PopFoul {	
		//облом тк Inning.walk() не вызывает исключений
	}*/

	@Override
	public void rainedHard() throws RainedOut {
		// TODO Auto-generated method stub		
	}	
	
	@Override
	public void event() {
		
	}
	public void atBat() throws PopFoul {
		// TODO Auto-generated method stub
		
	}
	public static void main(String[] args) {
		
			try {
				StormyInning si = new StormyInning();
				si.atBat();
			} catch (PopFoul e) {
				e.printStackTrace();
			} catch (RainedOut e) {
				e.printStackTrace();
			} catch (BaseBallException e) {
				e.printStackTrace();
			}
			
			try {
				Inning i = new StormyInning();
				i.atBat();
			} catch (RainedOut e) {				
				e.printStackTrace(System.out);
			} catch (Foul e) {
				e.printStackTrace();
			} catch (BaseBallException e) {
				e.printStackTrace();
			}
		
		

	}

	
}
